<template>
  <el-card shadow="never" style="margin-bottom:20px;">
    <div slot="header" class="clearfix">
      <span>相关法律法规</span>
      <div style="float: right; padding: 3px 0" type="text">
        <a @click="showDetails()">查看全部 &gt;</a>
      </div>
    </div>
    <el-table :show-header="false" :data="laws" class="left_menu_side">
      <el-table-column prop="subject" :show-overflow-tooltip="true" label="项目名称">
        <template slot-scope="scope">
          <a @click="getMore(scope.row)" >{{scope.row.subject}}</a>
        </template>
      </el-table-column>
      <el-table-column prop="publishtime" label="接收时间" width="180" align="right"></el-table-column>
    </el-table>
  </el-card>
</template>

<script>
  import { ACCESS_TOKEN } from '@/store/mutation-types'
  import Vue from 'vue'
  import { openIFrame } from '@/utils/util'

  const baseUrl = process.env.VUE_APP_ADD_HTTP
  const ticket = Vue.ls.get(ACCESS_TOKEN)

  export default {
    name: 'laws',
    data () {
      return {
        titleColor:false,
        laws:[]
      }
    },
    mounted(){
      this.getAdminList()
    },
    methods:{
      showDetails() {
        let ticket = Vue.ls.get(ACCESS_TOKEN);
        let ReturnUrl = encodeURIComponent('/Modules/PublicDocument/index.htm?request=SGWH_LawList&request_type=2#');
        let baseUrl = process.env.VUE_APP_ADD_HTTP;
        let url = baseUrl + '/login.xip?LoginMethod=ssologin&ticket=' +
          ticket + "&ReturnUrl=" + ReturnUrl + "";
        let title = '相关法律法规列表';
        openIFrame("SGWH-LawList", '/SGWHLawList', title, url);
        this.$router.push({ name: "SGWH-LawList" })
      },
      getMore(row) {
        let ReturnUrl = encodeURIComponent('/Modules/PublicDocument/view/view.htm?id=')
        let id = row.docid
        let title = row.subject
        let url = baseUrl + '/Modules/Login/EgovPlatformLogin.aspx?LoginMethod=ssologin&ticket=' +
          ticket + '&ReturnUrl=' + ReturnUrl + id + ''
        openIFrame(row.subject, '/LawView/' + id, title, url)
        this.$router.push({ name: row.subject })
      },
      getAdminList(){
        let that = this;
        let params ={
          serviceName:'Xinfo.Bus.BL.Service.EgovPlatform.PortalLet.PublicDocmentPortalLetService,Xinfo.Bus.BL.Service',
          getCount:false,
          guid:'sgwh_sgwhxgflfg',
          intTypeId:33,
          strBizType:'',
        }
        this.getRequest("/PortalLet/GetPortalLetData",params).then(res => {
            that.laws = res.data;
        })
      }
    }
  }
</script>